<template>
	<view class="box" @click="godetail">
		<view class="left">
			<u--image :showLoading="true" :src="avatarbg" radius="10rpx" width="100%"
				height="200rpx"></u--image>
		</view>
		<view class="right">
			<view class="top">
				<text>{{item.content}}</text>
			</view>
			<view class="buttom">
				<view class="le">
					<view class="up">
						<u--image shape="circle" :showLoading="true" :src="avatar" radius="10rpx"
							width="40rpx" height="40rpx"></u--image>
						<text>{{nickname}}</text>
					</view>
					<view class="datetime">
					{{times}}
					</view>
				</view>
				<view class="ri">
				
				</view>
			</view>

		</view>
	</view>
</template>

<script>
	import {formatDate } from "@/utils/time.js"
	export default {
		name: "my-piece",
		data() {
			return {
				showupdate: false
			};
		},
		computed:{
			avatarbg(){
				if(this.item.avatar){
					return  this.item.avatar
				}else{
					return '../../static/R-C.jpg'
				}
			},
			avatar(){
				if(this.item.user_id && this.item.user_id[0]){
					return  this.item.user_id[0].avatar
				}else{
					return '../../static/tx3.jpg'
				}
			},
			nickname(){
				if(this.item.user_id && this.item.user_id[0]){
					return  this.item.user_id[0].nickname
				}else{
					return '未知'
				}
			},
			times(){
				if(this.item){
					
					return formatDate(this.item.publish_date,1)
				}else{
					return formatDate(0)
				}
			}
		},
		props:['item'],
		methods: {
		
			godetail(){
					uni.navigateTo({
						url:`/pages_video/video-detail/video-detail?_id=${this.item._id}`
					})
			}
		}
	}
</script>

<style lang="scss" scoped>
	@keyframes myupdate {
		0% {
			opacity: 0;
			scale: 0;
			transform: translateY(-100rpx);
		}

		100% {
			opacity: 1;
			scale: 1;
			transform: translateY(0);
		}
	}

	.box {
		color:#c2d5ff;
		padding: 10rpx;
		display: flex;
		justify-content: space-around;
		height: 200rpx;
		margin-top: 10rpx;
		background-color: #283b65;
		// width: 100vw;
		.left {
			flex: 1;
			padding-right: 10rpx;
		}

		.right {
			flex: 1;
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			padding-left: 10rpx;

			.top {

				width: 100%;

				text {
					width: 100%;
					word-break: break-all;
					text-overflow: ellipsis;
					display: -webkit-box;
					-webkit-box-orient: vertical;
					-webkit-line-clamp: 2;
					overflow: hidden;
					font-size: 30rpx;

				}
			}

			.buttom {
				display: flex;
				justify-content: space-between;
				flex-direction: row;
				position: relative;

				.le {
					flex: 2;
					display: flex;
					flex-direction: column;
					justify-content: space-around;
					font-family: "YouYuan";

					.up {
						display: flex;
						justify-content: space-around;
						font-size: 25rpx;
						align-items: center;

						text {
							padding-right: 90rpx;
						}
					}

					.datetime {
						font-size: 30rpx;
						padding-left: 10rpx;
					}
				}

				.ri {
					flex: 1;
					padding-right: 10rpx;

					.updatepiece {
						.more-dot-fill {
							padding-top: 20rpx;
							float: right
						}

						.update {
							position: absolute;
							top: 70rpx;
							right: 0;
							background-color: #DCDCDC;
							width: 150rpx;
							animation: myupdate 0.5s;

							view {
								height: 50rpx;
								text-align: center;
								border-bottom: 2rpx solid #fff;
								font-family: "楷体";
								line-height: 50rpx;
							}

							view:hover {
								color: red;

							}
						}
					}
				}
			}
		}
	}
</style>